package cn.mysdp.biz.domain;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * InterfaceName: SdpProjectForExecuteExample
 * @Description:
 * @Author: SDP
 * @Date: 2025-02-07
 * @Version: 1.0
 * Table: sdp_project
 * Comment:
 * 
 */
public class SdpProjectForExecuteExample extends BaseExample {
    protected SdpProjectForExecute simple = new SdpProjectForExecute();

    protected List<Criteria> oredCriteria = new ArrayList<>();

    public void setSimple(SdpProjectForExecute simple) {
        this.simple = simple;
    }

    public SdpProjectForExecute getSimple() {
        return simple;
    }

    public List<Criteria> getOredCriteria() {
        return oredCriteria;
    }

    public void or(Criteria criteria) {
        oredCriteria.add(criteria);
    }

    public Criteria or() {
        Criteria criteria = createCriteriaInternal();
        oredCriteria.add(criteria);
        return criteria;
    }

    public Criteria createCriteria() {
        Criteria criteria = createCriteriaInternal();
        if (oredCriteria.size() == 0) {
            oredCriteria.add(criteria);
        }
        return criteria;
    }

    protected Criteria createCriteriaInternal() {
        Criteria criteria = new Criteria();
        return criteria;
    }

    public void clear() {
        oredCriteria.clear();
        orderByClause = null;
        distinct = false;
    }

    public static SdpProjectForExecuteExample createExample(SdpProjectForExecute request) throws Exception {
        return createExample(request, null);
    }

    public static SdpProjectForExecuteExample createExample(SdpProjectForExecute request, JSONObject options) throws Exception {
        SdpProjectForExecuteExample example = new SdpProjectForExecuteExample();
        example.setSimple(request);
        SdpProjectForExecuteExample.Criteria criteria = example.createCriteria();

        example.fixExample(SdpProjectForExecute.class, CriteriaString.class, criteria, options);

        if (options != null) {
            String orderBy = "";
            if (options.containsKey("order_by")) {
                orderBy = setCriteriaOrderBy(options.getJSONArray("order_by"), example);
                if (orderBy.length() > 0) {
                    example.setOrderByClause(orderBy);
                }
            }
        }

        return example;
    }

    private static String setCriteriaOrderBy(JSONArray jsonArray, SdpProjectForExecuteExample example) throws Exception {
        List<Object> request = Criterion.toList(jsonArray, CriteriaString.class);
        StringBuilder sb = new StringBuilder();
        int count = 0;
        for(int i = 0; i < request.size(); i++) {
            Object criteriaOrderByObj  = request.get(i);
            CriteriaString criteriaOrderBy = (CriteriaString)criteriaOrderByObj;
            int subCount = 0;

            subCount += appendCriteriaOrderByItem(sb, "`name`", criteriaOrderBy.getName());
            subCount += appendCriteriaOrderByItem(sb, "is_prepare", criteriaOrderBy.getIsPrepare());
            subCount += appendCriteriaOrderByItem(sb, "is_ai", criteriaOrderBy.getIsAi());
            subCount += appendCriteriaOrderByItem(sb, "param_info", criteriaOrderBy.getParamInfo());
            subCount += appendCriteriaOrderByItem(sb, "`result`", criteriaOrderBy.getResult());
            if (subCount > 1) {
                throw new Exception("order by数组元素对象属性多于1个(SdpProjectForExecuteExample):"+count+","+JSON.toJSONString(jsonArray.get(i)));
            }
            if (subCount == 0 && !"{}".equals(JSON.toJSONString(jsonArray.get(i)))) {
                throw new Exception("存在非法order by 字段(SdpProjectForExecuteExample):"+count+","+JSON.toJSONString(jsonArray.get(i)));
            }
            count++;
        }
        if (sb.length() == 0) {
            appendCriteriaOrderByItem(sb, "1", "");
        }

        return sb.toString();
    }

    protected abstract static class GeneratedCriteria {
        protected List<Criterion> criteria;

        protected GeneratedCriteria() {
            super();
            criteria = new ArrayList<>();
        }

        public boolean isValid() {
            return criteria.size() > 0;
        }

        public List<Criterion> getAllCriteria() {
            return criteria;
        }

        public List<Criterion> getCriteria() {
            return criteria;
        }

        protected void addCriterion(String condition) {
            if (condition == null) {
                throw new RuntimeException("Value for condition cannot be null");
            }
            criteria.add(new Criterion(condition));
        }

        protected void addCriterion(String condition, Object value, String property) {
            if (value == null) {
                throw new RuntimeException("Value for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value));
        }

        protected void addCriterion(String condition, Object value1, Object value2, String property) {
            if (value1 == null || value2 == null) {
                throw new RuntimeException("Between values for " + property + " cannot be null");
            }
            criteria.add(new Criterion(condition, value1, value2));
        }

        public Criteria andNameIsNull() {
            addCriterion("`name` is null");
            return (Criteria) this;
        }

        public Criteria andNameIsNotNull() {
            addCriterion("`name` is not null");
            return (Criteria) this;
        }

        public Criteria andNameEqualTo(String value) {
            addCriterion("`name` =", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameNotEqualTo(String value) {
            addCriterion("`name` <>", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameGreaterThan(String value) {
            addCriterion("`name` >", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameGreaterThanOrEqualTo(String value) {
            addCriterion("`name` >=", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameLessThan(String value) {
            addCriterion("`name` <", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameLessThanOrEqualTo(String value) {
            addCriterion("`name` <=", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameRegexp(String value) {
            addCriterion("`name` regexp", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameLike(String value) {
            addCriterion("`name` like", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameNotLike(String value) {
            addCriterion("`name` not like", value, "name");
            return (Criteria) this;
        }

        public Criteria andNameIn(List<String> values) {
            addCriterion("`name` in", values, "name");
            return (Criteria) this;
        }

        public Criteria andNameNotIn(List<String> values) {
            addCriterion("`name` not in", values, "name");
            return (Criteria) this;
        }

        public Criteria andNameBetween(String value1, String value2) {
            addCriterion("`name` between", value1, value2, "name");
            return (Criteria) this;
        }

        public Criteria andNameNotBetween(String value1, String value2) {
            addCriterion("`name` not between", value1, value2, "name");
            return (Criteria) this;
        }

        public Criteria andIsPrepareIsNull() {
            addCriterion("is_prepare is null");
            return (Criteria) this;
        }

        public Criteria andIsPrepareIsNotNull() {
            addCriterion("is_prepare is not null");
            return (Criteria) this;
        }

        public Criteria andIsPrepareEqualTo(Integer value) {
            addCriterion("is_prepare =", value, "isPrepare");
            return (Criteria) this;
        }

        public Criteria andIsPrepareNotEqualTo(Integer value) {
            addCriterion("is_prepare <>", value, "isPrepare");
            return (Criteria) this;
        }

        public Criteria andIsPrepareGreaterThan(Integer value) {
            addCriterion("is_prepare >", value, "isPrepare");
            return (Criteria) this;
        }

        public Criteria andIsPrepareGreaterThanOrEqualTo(Integer value) {
            addCriterion("is_prepare >=", value, "isPrepare");
            return (Criteria) this;
        }

        public Criteria andIsPrepareLessThan(Integer value) {
            addCriterion("is_prepare <", value, "isPrepare");
            return (Criteria) this;
        }

        public Criteria andIsPrepareLessThanOrEqualTo(Integer value) {
            addCriterion("is_prepare <=", value, "isPrepare");
            return (Criteria) this;
        }

        public Criteria andIsPrepareIn(List<Integer> values) {
            addCriterion("is_prepare in", values, "isPrepare");
            return (Criteria) this;
        }

        public Criteria andIsPrepareNotIn(List<Integer> values) {
            addCriterion("is_prepare not in", values, "isPrepare");
            return (Criteria) this;
        }

        public Criteria andIsPrepareBetween(Integer value1, Integer value2) {
            addCriterion("is_prepare between", value1, value2, "isPrepare");
            return (Criteria) this;
        }

        public Criteria andIsPrepareNotBetween(Integer value1, Integer value2) {
            addCriterion("is_prepare not between", value1, value2, "isPrepare");
            return (Criteria) this;
        }

        public Criteria andIsAiIsNull() {
            addCriterion("is_ai is null");
            return (Criteria) this;
        }

        public Criteria andIsAiIsNotNull() {
            addCriterion("is_ai is not null");
            return (Criteria) this;
        }

        public Criteria andIsAiEqualTo(Integer value) {
            addCriterion("is_ai =", value, "isAi");
            return (Criteria) this;
        }

        public Criteria andIsAiNotEqualTo(Integer value) {
            addCriterion("is_ai <>", value, "isAi");
            return (Criteria) this;
        }

        public Criteria andIsAiGreaterThan(Integer value) {
            addCriterion("is_ai >", value, "isAi");
            return (Criteria) this;
        }

        public Criteria andIsAiGreaterThanOrEqualTo(Integer value) {
            addCriterion("is_ai >=", value, "isAi");
            return (Criteria) this;
        }

        public Criteria andIsAiLessThan(Integer value) {
            addCriterion("is_ai <", value, "isAi");
            return (Criteria) this;
        }

        public Criteria andIsAiLessThanOrEqualTo(Integer value) {
            addCriterion("is_ai <=", value, "isAi");
            return (Criteria) this;
        }

        public Criteria andIsAiIn(List<Integer> values) {
            addCriterion("is_ai in", values, "isAi");
            return (Criteria) this;
        }

        public Criteria andIsAiNotIn(List<Integer> values) {
            addCriterion("is_ai not in", values, "isAi");
            return (Criteria) this;
        }

        public Criteria andIsAiBetween(Integer value1, Integer value2) {
            addCriterion("is_ai between", value1, value2, "isAi");
            return (Criteria) this;
        }

        public Criteria andIsAiNotBetween(Integer value1, Integer value2) {
            addCriterion("is_ai not between", value1, value2, "isAi");
            return (Criteria) this;
        }

        public Criteria andParamInfoIsNull() {
            addCriterion("param_info is null");
            return (Criteria) this;
        }

        public Criteria andParamInfoIsNotNull() {
            addCriterion("param_info is not null");
            return (Criteria) this;
        }

        public Criteria andParamInfoEqualTo(String value) {
            addCriterion("param_info =", value, "paramInfo");
            return (Criteria) this;
        }

        public Criteria andParamInfoNotEqualTo(String value) {
            addCriterion("param_info <>", value, "paramInfo");
            return (Criteria) this;
        }

        public Criteria andParamInfoGreaterThan(String value) {
            addCriterion("param_info >", value, "paramInfo");
            return (Criteria) this;
        }

        public Criteria andParamInfoGreaterThanOrEqualTo(String value) {
            addCriterion("param_info >=", value, "paramInfo");
            return (Criteria) this;
        }

        public Criteria andParamInfoLessThan(String value) {
            addCriterion("param_info <", value, "paramInfo");
            return (Criteria) this;
        }

        public Criteria andParamInfoLessThanOrEqualTo(String value) {
            addCriterion("param_info <=", value, "paramInfo");
            return (Criteria) this;
        }

        public Criteria andParamInfoRegexp(String value) {
            addCriterion("param_info regexp", value, "paramInfo");
            return (Criteria) this;
        }

        public Criteria andParamInfoLike(String value) {
            addCriterion("param_info like", value, "paramInfo");
            return (Criteria) this;
        }

        public Criteria andParamInfoNotLike(String value) {
            addCriterion("param_info not like", value, "paramInfo");
            return (Criteria) this;
        }

        public Criteria andParamInfoIn(List<String> values) {
            addCriterion("param_info in", values, "paramInfo");
            return (Criteria) this;
        }

        public Criteria andParamInfoNotIn(List<String> values) {
            addCriterion("param_info not in", values, "paramInfo");
            return (Criteria) this;
        }

        public Criteria andParamInfoBetween(String value1, String value2) {
            addCriterion("param_info between", value1, value2, "paramInfo");
            return (Criteria) this;
        }

        public Criteria andParamInfoNotBetween(String value1, String value2) {
            addCriterion("param_info not between", value1, value2, "paramInfo");
            return (Criteria) this;
        }

        public Criteria andResultIsNull() {
            addCriterion("`result` is null");
            return (Criteria) this;
        }

        public Criteria andResultIsNotNull() {
            addCriterion("`result` is not null");
            return (Criteria) this;
        }

        public Criteria andResultEqualTo(String value) {
            addCriterion("`result` =", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultNotEqualTo(String value) {
            addCriterion("`result` <>", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultGreaterThan(String value) {
            addCriterion("`result` >", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultGreaterThanOrEqualTo(String value) {
            addCriterion("`result` >=", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultLessThan(String value) {
            addCriterion("`result` <", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultLessThanOrEqualTo(String value) {
            addCriterion("`result` <=", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultRegexp(String value) {
            addCriterion("`result` regexp", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultLike(String value) {
            addCriterion("`result` like", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultNotLike(String value) {
            addCriterion("`result` not like", value, "result");
            return (Criteria) this;
        }

        public Criteria andResultIn(List<String> values) {
            addCriterion("`result` in", values, "result");
            return (Criteria) this;
        }

        public Criteria andResultNotIn(List<String> values) {
            addCriterion("`result` not in", values, "result");
            return (Criteria) this;
        }

        public Criteria andResultBetween(String value1, String value2) {
            addCriterion("`result` between", value1, value2, "result");
            return (Criteria) this;
        }

        public Criteria andResultNotBetween(String value1, String value2) {
            addCriterion("`result` not between", value1, value2, "result");
            return (Criteria) this;
        }

    }

    public static class CriteriaString {
        @JsonProperty("name")
        @JSONField(name = "name")
        private String name;

        public String getName() {
            return name;
        }
        
        public void setName(String _v) {
            name = _v;
        }

        @JsonProperty("is_prepare")
        @JSONField(name = "is_prepare")
        private String isPrepare;

        public String getIsPrepare() {
            return isPrepare;
        }
        
        public void setIsPrepare(String _v) {
            isPrepare = _v;
        }

        @JsonProperty("is_ai")
        @JSONField(name = "is_ai")
        private String isAi;

        public String getIsAi() {
            return isAi;
        }
        
        public void setIsAi(String _v) {
            isAi = _v;
        }

        @JsonProperty("param_info")
        @JSONField(name = "param_info")
        private String paramInfo;

        public String getParamInfo() {
            return paramInfo;
        }
        
        public void setParamInfo(String _v) {
            paramInfo = _v;
        }

        @JsonProperty("result")
        @JSONField(name = "result")
        private String result;

        public String getResult() {
            return result;
        }
        
        public void setResult(String _v) {
            result = _v;
        }

    }

    public static class Criteria extends GeneratedCriteria {
        protected Criteria() {
            super();
        }
    }
}
